import requests


class TPship_login(object):



    # 验证码请求 封装
    @classmethod
    def verify(cls,session):
        session.get(url="https://hmshop-test.itheima.net/index.php?m=Home&c=User&a=verify&r=0.9481046124662501")

    # 登录请求 封装
    @classmethod
    def login(cls,session,login_data):
        resp = session.post(
            url="https://hmshop-test.itheima.net/index.php?m=Home&c=User&a=do_login&t=0.3270702534589863",
            data=login_data)

        return resp


# 测试
if __name__ == '__main__':
    session=requests.Session()

    login_data={"username": "13500001111", "password": "111222", "verify_code": "8888"}

    # 验证码请求
    TPship_login.verify(session)
    # 登录请求
    response=TPship_login.login(session,login_data)
    print(response.text)